/*
 * InformesDAO.java
 *
 * Created on 31 de octubre de 2006, 04:29 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package com.src.computec.radar.services.utilities.dao;

import com.src.computec.radar.base.dao.GenericDAO;
import com.src.computec.radar.base.dao.exception.DAOException;
import com.src.computec.radar.services.base.constantes.ConstantesGenerales;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.src.computec.radar.services.utilities.dto.UsuarioPortalWasDto;

/**
 *
 * @author aocampo
 */
public class InformesDAO extends GenericDAO implements BaseInformesDAO {
    
    /** Creates a new instance of LdapDAO */
    public InformesDAO() {
    }
    
    public void insertUsuarioPortalWas(UsuarioPortalWasDto dto) throws DAOException {
        Connection con = null;
        PreparedStatement statement = null;
        try {
            con = getConnectionDB2();
            statement = con.prepareStatement("INSERT INTO " + ConstantesGenerales.getInstance().SCHEMA + ".USUARIO_PORTAL_WAS (IDLOGON, USERID, ROLES, GRUPO_PRODUCTO) " +
                                             "VALUES (?, ?, ?, ?)");
            int indice = 0;
            statement.setTimestamp(++indice, dto.getIdLogon());
            statement.setObject(++indice, dto.getUserId());
            statement.setObject(++indice, dto.getRoles());
            statement.setObject(++indice, dto.getGrupoProducto());
            statement.executeUpdate();
        }
        catch (SQLException e) {
            throw new DAOException("InformesDAO:insertUsuarioPortalWas: " + e.toString(), e);
        }
        finally {
            closeConnection(con, statement);
        }
    }
}